/*
* 阔地教育科技有限公司版权所有（codyy.com/codyy.cn）.
* Copyright (c) 2019, Codyy and/or its affiliates. All rights reserved.
* @Date: 2020.01.02 00:31.
* @Author
* @Description 新品模块使用的  产品系列  - 组建
**/
<template>
  <!-- <dl :class="getName" >
    <dt><img :src="productData.url" /></dt>
    <dd v-for="val in productData.list" :key="val.id" @click="handleRouterClick(val)">
      <img :src="val.url" />
      <p>{{ val.name }}</p>
    </dd>
  </dl> -->
  <div v-if="terminal === 'pc'" class="pc "> 
  <div class="pro-right" >
  <div class="news-xp cl" >
    <div class="news-xp-left">
        <img :src="productData.url"  :onerror="defaultImg" />

      </div><!--news-left-->
      <div class="news-xp-right cl" >
        <ul class="cl">
          <li v-for="val in productData.list" :key="val.id" @click="handleRouterClick(val)" >
            <a ><img :src="val.url"  width="217px" height="197px"></a>
              <p><a>{{ val.name }}</a></p>
          </li>
        </ul>
        </div>
  </div>
  </div>
</div> <!--pc样式-->
  <div v-else class="phone">
    <div class="por_list">
    <div class="left_pic">
        <img  :src="productData.url" :onerror="defaultImg" >
    </div>
     <div class="news-xp-right cl">
          <ul class="cl">
            <li v-for="val in productData.list" :key="val.id" @click="handleRouterClick(val)">
              <a ><img :src="val.url"  width="217px" height="197px"></a>
                <p><a>{{ val.name }}</a></p>
            </li>
          </ul>
     </div>
    </div>
  </div>
</template>
<script>

export default {
  name: 'ProductSerie',
  props: {
    productData: {
      type: Object,
      default: () => {
        return {
          time: 'time',
          title: 'title',
          url: '../../assets/img/zujin1.jpg'
        }
      }
    }
  },
  data () {
    return {
      clclass:{height:''},
      terminal: '', // 终端类型
      defaultImg: 'this.src="' + require('../../assets/img/errimg.jpg') + '"' //默认图地址
    }
  },
  computed: {
    getName(){
      if(this.terminal === 'pc'){
        return 'h-product'
      } else {
        return 'h-product h-ph'
      }
    }
  },
  created () {
    this.terminal = localStorage.getItem('terminalm')
    console.log('this.terminal***', this.terminal)
    
  },
  mounted () {
    
  },
  methods: {
    /**
    *@Description
    *@Param
    *@Return 点击跳转路由.
    **/
    handleRouterClick(item){
      console.log(item)
      this.$router.push({ name: item.router, params: { id: item.id } })
    },
  }
}
</script>
<style lang="scss" scoped>
.cl {
    zoom: 1;
}
img {
    border: none;
    display: block;
    vertical-align:middle;
}

.phone{
  img {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    max-width: 100%;
    height: auto;
    vertical-align: middle;
    border: 0;
  }
    .left_pic {
      width: 50%;
      float: left;
  }
    .news-xp-right li {
      width: 50%;
      float: left;
      list-style: none;
  }
}
.pc{
    min-height: 300px;
    height: auto;
 .pro-right{
   margin-top: 28px;
     width: 100%;
    height: 100%;
    background: #fff;
 }
.news-xp-left {
    width: 320px;
    float: left;
    display: block;
      img {
      width: 100%;
      margin-bottom: 30px;
      display: block;
      }
}
.news-xp-right {
    width: calc(100% - 320px);
    float: right;
}
ul {
    margin: 0px;
    padding: 0px;
    list-style: none;
}
.news-xp-right ul li {
    margin-left: 18px;
    float: left;
    width: 217px;
    border-bottom: 1px solid #000;
    height: 251px;
    overflow: hidden;
    margin-bottom: 20px;
}
.news-xp-right ul li a {
    font-size: 12px;
    color: #000000;
    text-align: center;
    display: block;
    line-height: 38px;
}
.news-xp-right ul li p {
    margin-top: 15px;
}
}
</style>
<style lang="scss" scoped>
  .h-product{
    position: relative;
    top:10px;
    padding-left: 320px;
    dt{
      position: absolute;
      height: 400px;
      width: 320px;
      left: 0;
      img{
        height: 230px;
      }
    }
    dd{
      width: 220px;
      float: left;
      margin-left: 15px;
      margin-bottom: 15px;
      border-bottom: 1px solid #333;
      cursor: pointer;
      img{
        height: 200px;
      }
      p{
        margin: 10px 0;
        text-align: center;
        &:hover{
          text-decoration: underline;
        }
      }
    }
  }
  /* 移动端 */
  .h-product.h-ph{
    padding-left: 0;
   
    dt{
      display: none;
    position: relative;
      bottom:10px;
      width: calc(100% - 22px);
      margin-left: 15px;
       img{
        width: 100%;
        height: auto;
      }
    }
     dd{
       position: relative;
      top: 5px;
      width: calc(50% - 22px);
      margin-left: 15px;
      img{
        width: 100%;
        height: auto;
      }
    }
  }
</style>
